package com.cltech.mapper;


import com.cltech.dto.SysDicItemDto;
import com.cltech.entity.sys.SysDicItem;
import org.mapstruct.*;
import org.springframework.data.domain.Page;

import java.util.List;

/**
 * Created by Administrator on 2019/4/8.
 */
@Mapper(componentModel = "spring")
public interface SysDicItemMapper {
	@Mappings({
			@Mapping(source = "dicId", target = "dic.id"),
			@Mapping(source = "dicName", target = "dic.name"),
			@Mapping(source = "dicCode", target = "dic.code")
	})
	SysDicItem dtoToEntity(SysDicItemDto sysDicDto);
	@InheritConfiguration
	List<SysDicItem> dtoToEntity(List<SysDicItemDto> sysDicDto);
	@InheritInverseConfiguration
	SysDicItemDto entityToDto(SysDicItem sysDic);
	@InheritInverseConfiguration
	List<SysDicItemDto> entityToDto(List<SysDicItem> sysDic);
	default Page<SysDicItemDto> entityToDto(Page<SysDicItem> page){
		return page.map(this::entityToDto);
	}
}
